package com.kandinfo.survey.weixin.service.impl;

import java.net.UnknownHostException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import com.kandinfo.base.admin.repository.mongo.MongoRepository;
import com.kandinfo.survey.weixin.mongo.WxConfigure;
import com.kandinfo.survey.weixin.service.WxConfigureService;
import com.mongodb.Mongo;

@Service
public class WxConfigureServiceImpl extends MongoRepository<WxConfigure, String> implements WxConfigureService {

	@SuppressWarnings("deprecation")
	public WxConfigureServiceImpl(String mongoHost, int mongoPort, String mongoDbName) {
		try {
			this.setMongoTemplate(new MongoTemplate(new Mongo(mongoHost, mongoPort), mongoDbName));
		} catch (UnknownHostException e) {
		}
	}

	@Resource
	public void setMongoTemplate(MongoTemplate mongoTemplate) {
		super.setMongoTemplate(mongoTemplate);
	}

	public WxConfigureServiceImpl() {
		super();
	}

	@Override
	public Class<? extends WxConfigure> getTClass() {
		return WxConfigure.class;
	}

	@Override
	public WxConfigure save(WxConfigure wxConfigure) {
		return super.save(wxConfigure);
	}

	@Override
	public WxConfigure findOne(String id) {
		return super.findOne(id);
	}

	public void delete(WxConfigure wxConfigure) {
		super.delete(wxConfigure);
	}

	@Override
	public List<WxConfigure> findAll(List<String> idList) {
		return super.findAll(idList);
	}

	@Override
	public void saveAll(List<WxConfigure> dtos) {
		super.insertAll(dtos);
	}

	@Override
	public List<WxConfigure> findByCriteria(Criteria criteria) {
		return super.findByCondition(criteria);
	}

	@Override
	public List<WxConfigure> findByQuery(Query query) {
		return super.findByQuery(query);
	}

}
